<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s"  uri="/struts-tags"%>


<body>
<script type="text/javascript">  
$(function() {
			$("#grade").change(function(){
				//var gradeId= $(this).find("option[selected=true]").val();
				var gradeId=$("#grade").val();
				if(gradeId == -1){
					$("#squads").empty();
					$("<option value='-1'>--请选择--</option>").appendTo($("#squads"));
						
				}
				else{
					var aurl = "dropdown";
					var adata = "  name=rr&sid="+gradeId;
					alert(adata);
					$.ajax({
						url:aurl,
						type:'POST',
						data:adata,
						dataType:'json',
						error:function(){
							alert("请求失败");
						},
						success:function(data){
							alert(data);
							$("#squads").empty();
							$("<option value='-1'>--请选择--</option>").appendTo($("#squads"));
							for(var i = 0; i < data.length; i++){
								$("<option value='"+data[i].sqId+"'>"+data[i].sqName+"</option>").appendTo($("#squads"));
							}
						}
					});
				}
			});
		});

</script>

	<table class="editbox">
		<tr>
			<td class="title"><span class="required">*</span><strong>年级名称：</strong>
			</td>
			<td>
			<s:select id="grade" list="#{1:'grade1',2:'grade2'}" name="grade.gradeId" value="grade.gradeId" headerKey="-1" headerValue="---请选择---">
			</s:select>
			</td>
			<td class="title"><span class="required">*</span><strong>班级名称：</strong>
			</td>
			<td><select id="squads" name="squads.sqId" value="squads.sqId" style="width:120px;">
			</select></td>
		</tr>
	</table>
</body>
